<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
	<meta charset="UTF-8">
	<link rel="shortcut icon" href="favicon.ico">
	<link rel="stylesheet" href="css/iconfont.css">
	<link rel="stylesheet" href="css/global.css">
	<link rel="stylesheet" href="css/bootstrap.min.css">
	<link rel="stylesheet" href="css/bootstrap-theme.min.css">
	<link rel="stylesheet" href="css/swiper.min.css">
	<link rel="stylesheet" href="css/styles.css">
	<script src="js/jquery.1.12.4.min.js" charset="UTF-8"></script>
	<script src="js/bootstrap.min.js" charset="UTF-8"></script>
	<script src="js/swiper.min.js" charset="UTF-8"></script>
	<script src="js/global.js" charset="UTF-8"></script>
	<script src="js/jquery.DJMask.2.1.1.js" charset="UTF-8"></script>
	<script type="text/javascript" src="layer/layer.js"></script>
	<title>广内殿</title>
	<script type="text/javascript">
		
	$(function(){
		var u=JSON.parse(window.localStorage.getItem("user"));
			console.log(u);
			if (u!=null) {
				$("#yinCang").hide();
				$("#xianShi").show();
				$("#uName").html(u.username);
				$("#uId").html(u.uid);
			}
			
			$.post("getOrder",{
				userId:u.uid
			},function(res){
				console.log(res);
				for (var i = 0; i < res.length; i++) {
					$("#myTab").append(`
							<tr class="order-item">
							<td>
								<label>
									<a href="udai_order_detail.html" class="num">
										<span>${res[i].orderDate}</span>
										订单号: ${res[i].o_id}
									</a>
									<div class="card">
										<div class="img"><img src="images/${res[i].books.img}" alt="" class="cover"></div>
										<div class="name ep2">${res[i].books.name}</div>
										<div class="format">出版社：${res[i].books.brand}</div>
										
									</div>
								</label>
							</td>
							<td>￥${res[i].books.discountPrice}</td>
							<td>${res[i].number}</td>
							<td>￥${res[i].totalMoney}<br></td>
							<td class="state">
								<a class="but c6">${res[i].status}</a>
								
							</td>
							<td class="order">
								<div class="del"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></div>
								
							</td>
						</tr>
							`);
				}
			},"json");
			
		});
		function yFH(){
			var u=JSON.parse(window.localStorage.getItem("user"));
			var sta=$("#yfh").html();
			$(" tr:gt(0)").remove();//删除除第一个tr后的所有tr
			$.post("getOrderByStatus",{
				userId:u.uid,
				status:sta
			},function(res){
				for (var i = 0; i < res.length; i++) {
					$("#myTab2").append(`
							<tr class="order-item">
							<td>
								<label>
									<a href="udai_order_detail.html" class="num">
										<span>${res[i].orderDate}</span>
										订单号: ${res[i].o_id}
									</a>
									<div class="card">
										<div class="img"><img src="images/${res[i].books.img}" alt="" class="cover"></div>
										<div class="name ep2">${res[i].books.name}</div>
										<div class="format">出版社：${res[i].books.brand}</div>
										
									</div>
								</label>
							</td>
							<td>￥${res[i].books.discountPrice}</td>
							<td>${res[i].number}</td>
							<td>￥${res[i].totalMoney}<br></td>
							<td class="state">
								<a class="but c6">${res[i].status}</a>
								
							</td>
							<td class="order">
								<div class="del"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></div>
							
							</td>
						</tr>
							`);
				}
			},"json");
		}
		function wFH(){
			var u=JSON.parse(window.localStorage.getItem("user"));
			var sta=$("#wfh").html();
			$(" tr:gt(0)").remove();//删除除第一个tr后的所有tr
			$.post("getOrderByStatus",{
				userId:u.uid,
				status:sta
			},function(res){
				for (var i = 0; i < res.length; i++) {
					$("#myTab3").append(`
							<tr class="order-item">
							<td>
								<label>
									<a href="udai_order_detail.html" class="num">
										<span>${res[i].orderDate}</span>
										订单号: ${res[i].o_id}
									</a>
									<div class="card">
										<div class="img"><img src="images/${res[i].books.img}" alt="" class="cover"></div>
										<div class="name ep2">${res[i].books.name}</div>
										<div class="format">出版社：${res[i].books.brand}</div>
										
									</div>
								</label>
							</td>
							<td>￥${res[i].books.discountPrice}</td>
							<td>${res[i].number}</td>
							<td>￥${res[i].totalMoney}<br></td>
							<td class="state">
								<a class="but c6">${res[i].status}</a>
								
							</td>
							<td class="order">
								<div class="del"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></div>
								
							</td>
						</tr>
							`);
				}
			},"json");
		}
		function ySH(){
			var u=JSON.parse(window.localStorage.getItem("user"));
			var sta=$("#ysh").html();
			$(" tr:gt(0)").remove();//删除除第一个tr后的所有tr
			$.post("getOrderByStatus",{
				userId:u.uid,
				status:sta
			},function(res){
				for (var i = 0; i < res.length; i++) {
					$("#myTab4").append(`
							<tr class="order-item">
							<td>
								<label>
									<a href="udai_order_detail.html" class="num">
										<span>${res[i].orderDate}</span>
										订单号: ${res[i].o_id}
									</a>
									<div class="card">
										<div class="img"><img src="images/${res[i].books.img}" alt="" class="cover"></div>
										<div class="name ep2">${res[i].books.name}</div>
										<div class="format">出版社：${res[i].books.brand}</div>
										
									</div>
								</label>
							</td>
							<td>￥${res[i].books.discountPrice}</td>
							<td>${res[i].number}</td>
							<td>￥${res[i].totalMoney}<br></td>
							<td class="state">
								<a class="but c6">${res[i].status}</a>
								
							</td>
							<td class="order">
								<div class="del"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></div>
								
							</td>
						</tr>
							`);
				}
			},"json");
		}
		function wSH(){
			var u=JSON.parse(window.localStorage.getItem("user"));
			var sta=$("#wsh").html();
			$(" tr:gt(0)").remove();//删除除第一个tr后的所有tr
			$.post("getOrderByStatus",{
				userId:u.uid,
				status:sta
			},function(res){
				for (var i = 0; i < res.length; i++) {
					$("#myTab5").append(`
							<tr class="order-item">
							<td>
								<label>
									<a href="udai_order_detail.html" class="num">
										<span>${res[i].orderDate}</span>
										订单号: ${res[i].o_id}
									</a>
									<div class="card">
										<div class="img"><img src="images/${res[i].books.img}" alt="" class="cover"></div>
										<div class="name ep2">${res[i].books.name}</div>
										<div class="format">出版社：${res[i].books.brand}</div>
										
									</div>
								</label>
							</td>
							<td>￥${res[i].books.discountPrice}</td>
							<td>${res[i].number}</td>
							<td>￥${res[i].totalMoney}<br></td>
							<td class="state">
								<a class="but c6">${res[i].status}</a>
								<button onclick="qr(this,${res[i].o_id})">确认收货</button>
								
							</td>
							<td class="order">
								<div class="del"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></div>
								
							</td>
						</tr>
							`);
				}
			},"json");
		}
		
		function qr(obj,id){
			var sta="已收货";
			$.post("xiuGaiOrder",{
				o_id:id,
				status:sta
			},function(res){
				if (res.code=="0") {
					layer.alert("收货成功");
					window.location.href="udai_order.html";
				} else {
					layer.alert("收货失败");
				}
			},"json");
		}
		function cAll(){
			var u=JSON.parse(window.localStorage.getItem("user"));
			var sta=$("#wsh").html();
			$(" tr:gt(0)").remove();//删除除第一个tr后的所有tr
			$.post("getOrder",{
				userId:u.uid
			},function(res){
				console.log(res);
				for (var i = 0; i < res.length; i++) {
					$("#myTab").append(`
							<tr class="order-item">
							<td>
								<label>
									<a href="udai_order_detail.html" class="num">
										<span>${res[i].orderDate}</span>
										订单号: ${res[i].o_id}
									</a>
									<div class="card">
										<div class="img"><img src="images/${res[i].books.img}" alt="" class="cover"></div>
										<div class="name ep2">${res[i].books.name}</div>
										<div class="format">出版社：${res[i].books.brand}</div>
										
									</div>
								</label>
							</td>
							<td>￥${res[i].books.discountPrice}</td>
							<td>${res[i].number}</td>
							<td>￥${res[i].totalMoney}<br></td>
							<td class="state">
								<a class="but c6">${res[i].status}</a>
								
							</td>
							<td class="order">
								<div class="del"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></div>
								
							</td>
						</tr>
							`);
				}
			},"json");
		}
	</script>
	
</head>
<body>
	<!-- 顶部tab -->
	<div class="tab-header">
		<div class="inner">
			<div class="pull-left">
				<div class="pull-left">嗨，欢迎来到<span class="cr">广内殿</span></div>
			</div>
			<div class="pull-right">
			<span id="yinCang">
				<a href="login.html"><span class="cr">登录</span></a>
				<a href="login2.html">注册</a>
			</span>
			<span style="display:none;" id="xianShi">
				uid:<span id="uId"></span>
				欢迎:<span id="uName"></span>
			</span>
				<a href="udai_setting.html">个人中心</a>
				<a href="udai_order.html">我的订单</a>
			</div>
		</div>
	</div>
	<!-- 顶部标题 -->
	<div class="bgf5 clearfix">
		<div class="top-user">
			<div class="inner">
				<a class="logo" href="index.html"><img src="images/icons/logo.jpg" alt="U袋网" class="cover"></a>
				<div class="title">个人中心</div>
			</div>
		</div>
	</div>
	<div class="content clearfix bgf5">
		<section class="user-center inner clearfix">
			<div class="pull-left bgf">
				<a href="udai_setting.html" class="title">广内殿欢迎页</a>
				<dl class="user-center__nav">
					<dt>帐户信息</dt>
					<a href="udai_setting.html"><dd>个人资料</dd></a>
					<a href="udai_address_edit.html"><dd>收货地址</dd></a>
					<a href="udai_pwd_modify.html"><dd>修改登录密码</dd></a>
				</dl>
				<dl class="user-center__nav">
					<dt>订单中心</dt>
					<a href="udai_order.html"><dd class="active">我的订单</dd></a>
				</dl>
			</div>
			<div class="pull-right">
				<div class="user-content__box clearfix bgf">
					<div class="title">订单中心-我的订单</div>
					<div class="order-list__box bgf">
						<div class="order-panel">
							<ul class="nav user-nav__title" role="tablist">
								<li role="presentation" class="nav-item active"><a href="#all" onclick="cAll()" aria-controls="all" role="tab" data-toggle="tab">所有订单</a></li>
								<li role="presentation" class="nav-item "><a href="#pay" onclick="yFH()" aria-controls="pay" role="tab" data-toggle="tab"><span id="yfh">已付款</span></a></li>
								<li role="presentation" class="nav-item "><a href="#emit" onclick="wFH()" aria-controls="emit" role="tab" data-toggle="tab"><span id="wfh">未付款</span></a></li>
								<li role="presentation" class="nav-item "><a href="#take" onclick="ySH()" aria-controls="take" role="tab" data-toggle="tab"><span id="ysh">已收货</span></a></li>
								<li role="presentation" class="nav-item "><a href="#eval" onclick="wSH()" aria-controls="eval" role="tab" data-toggle="tab"><span id="wsh">未收货</span></a></li>
							</ul>

							<div class="tab-content">
								<div role="tabpanel" class="tab-pane fade in active" id="all">
									<table id="myTab" class="table text-center">
										<tr>
											<th width="380">商品信息</th>
											<th width="85">单价</th>
											<th width="85">数量</th>
											<th width="120">实付款</th>
											<th width="120">交易状态</th>
											
										</tr>		
									</table>
									
								</div>
								<div role="tabpanel" class="tab-pane fade" id="pay">
									<table id="myTab2" class="table text-center">
										<tr>
											<th width="380">商品信息</th>
											<th width="85">单价</th>
											<th width="85">数量</th>
											<th width="120">实付款</th>
											<th width="120">交易状态</th>
											<th width="120">交易操作</th>
										</tr>
										
									</table>
								</div>
								<div role="tabpanel" class="tab-pane fade" id="emit">
									<table id=myTab3 class="table text-center">
										<tr>
											<th width="380">商品信息</th>
											<th width="85">单价</th>
											<th width="85">数量</th>
											<th width="120">实付款</th>
											<th width="120">交易状态</th>
											<th width="120">交易操作</th>
										</tr>
										
									</table>
									
								</div>
								<div role="tabpanel" class="tab-pane fade" id="take">
									<table id="myTab4" class="table text-center">
										<tr>
											<th width="380">商品信息</th>
											<th width="85">单价</th>
											<th width="85">数量</th>
											<th width="120">实付款</th>
											<th width="120">交易状态</th>
											<th width="120">交易操作</th>
										</tr>
									</table>
								</div>
								
								<div role="tabpanel" class="tab-pane fade" id="eval">
									<table id="myTab5" class="table text-center">
										<tr>
											<th width="380">商品信息</th>
											<th width="85">单价</th>
											<th width="85">数量</th>
											<th width="120">实付款</th>
											<th width="120">交易状态</th>
											<th width="120">交易操作</th>
										</tr>
										
									</table>
								
								</div>
								
							</div>
						</div>
					</div>
				
				</div>
			</div>
		</section>
	</div>
	<!-- 右侧菜单 -->
	
	<!-- 底部信息 -->
	<div class="footer">
		
		<div class="footer-links inner">
			<dl>
				<dt>U袋网</dt>
				<a href="temp_article/udai_article10.html"><dd>企业简介</dd></a>
				<a href="temp_article/udai_article11.html"><dd>加入U袋</dd></a>
				<a href="temp_article/udai_article12.html"><dd>隐私说明</dd></a>
			</dl>
			<dl>
				<dt>服务中心</dt>
				<a href="temp_article/udai_article1.html"><dd>售后服务</dd></a>
				<a href="temp_article/udai_article2.html"><dd>配送服务</dd></a>
				<a href="temp_article/udai_article3.html"><dd>用户协议</dd></a>
				<a href="temp_article/udai_article4.html"><dd>常见问题</dd></a>
			</dl>
			<dl>
				<dt>新手上路</dt>
				<a href="temp_article/udai_article5.html"><dd>如何成为代理商</dd></a>
				<a href="temp_article/udai_article6.html"><dd>代销商上架教程</dd></a>
				<a href="temp_article/udai_article7.html"><dd>分销商常见问题</dd></a>
				<a href="temp_article/udai_article8.html"><dd>付款账户</dd></a>
			</dl>
		</div>
		<div class="copy-box clearfix">
			<ul class="copy-links">
				<a href="agent_level.html"><li>网店代销</li></a>
				<a href="class_room.html"><li>U袋学堂</li></a>
				<a href="udai_about.html"><li>联系我们</li></a>
				<a href="temp_article/udai_article10.html"><li>企业简介</li></a>
				<a href="temp_article/udai_article5.html"><li>新手上路</li></a>
			</ul>
			<!-- 版权 -->
			<p class="copyright">
				© 2005-2017 U袋网 版权所有，并保留所有权利<br>
				ICP备案证书号：闽ICP备16015525号-2&nbsp;&nbsp;&nbsp;&nbsp;福建省宁德市福鼎市南下村小区（锦昌阁）1栋1梯602室&nbsp;&nbsp;&nbsp;&nbsp;Tel: 18650406668&nbsp;&nbsp;&nbsp;&nbsp;E-mail: 18650406668@qq.com
			</p>
		</div>
	</div>
</body>
</html>